package com.bw.shopping.mvvm.model;

import com.bw.mvvm_common.entity.BaseEntity;
import com.bw.mvvm_common.mvvm.model.BaseModel;
import com.bw.mvvm_common.network.HttpEnum;
import com.bw.mvvm_common.network.HttpFactory;

import java.util.HashMap;

import io.reactivex.Observable;

/**
 * @author KK
 * @description:
 * @date :2021/10/21 19:34
 */
public class ShoppingModel extends BaseModel {

    public Observable<BaseEntity> requestShopping(HashMap<String,Object> map){

        return changeFunc(HttpFactory.create(HttpEnum.TokenSign)
        .getRetrofit()
        .create(Api.class)
        .requestShopping(createBody(map)));
    }


    public Observable<BaseEntity> requestShoppAdd(HashMap<String,Object> map){
        return changeFunc(HttpFactory.create(HttpEnum.TokenSign)
                .getRetrofit()
                .create(Api.class)
                .requsetAddshopp(createBody(map)));
    }

    //删除购物车
    public Observable<BaseEntity> requestDelShopp(HashMap<String,Object> map){
        return changeFunc(HttpFactory.create(HttpEnum.Token)
                .getRetrofit()
                .create(Api.class)
                .requsetdelShopp(createBody(map)));
    }

    //提交订单
    public Observable<BaseEntity> requestSubmitCar(HashMap<String,Object> map){
        return changeFunc(HttpFactory.create(HttpEnum.Token)
                .getRetrofit()
                .create(Api.class)
                .requestSubmitCar(createBody(map)));

    }
}
